package example

import (
	"gitee.com/windwolfs/battle/apis/jrpc"
	"gitee.com/windwolfs/battle/room"
	"log"
)

type Room struct {
	*room.SimpleRoom
	Owner string
}

func NewRoom(roomId string) *Room {
	r := &Room{
		SimpleRoom: room.NewSimpleRoom(roomId),
		Owner:      "",
	}

	r.PullPacket = r

	return r
}

func (p *Room) Fetch(client room.Client, message *jrpc.Message) {
	log.Printf("[CUSTOM_ROOM] 接收到来自 (%s) 的数据包 %d\n", client.SessionId(), message.PacketType)

	client.SendPacket([]byte("Hello"))
}
